home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir26 / epimap1.zip / BGI03.EXE / GDHEAD.PS < prev   
Text File  |  1991-12-13  |  25KB  |  923 lines

  1. %%DocumentFonts: (atend)
  2. %%Creator: GRAF/DRIVE PLUS
  3. %%EndComments
  4.  
  5. %* GRAF/DRIVE PLUS Copyright (C) 1990-91  M.K. Fleming  All Rights Reserved
  6.  
  7. % -------------------------- VARIABLE LIST --------------------------------
  8. %
  9. % PERMANENT DEFINITIONS:
  10. % StdLine                         1-unit line width in decipoints
  11. % MonoColors                      Color definitions for 'mono' option
  12. % GrayColors                      Color definitions for 'gray' option
  13. % ColorColors                     Color definitions for 'color' option
  14. % ColorOptions                    Indexable lookup table of color choices
  15. % ColorMode                       0=mono,1=gray,2=color
  16. %
  17. %
  18. % CURRENT STATUS INFO:
  19. % CurFont                         current font
  20. % TxtDir                          text direction (0=horizontal, 1=vertical)
  21. % TxtHt                           text height
  22. % FillColor                       filling color
  23. % DrawColor                       drawing color
  24. % FillStyle                       fill pattern id
  25. % LineWidth                       line width (as multiple of StdLine)
  26. % LineStyle                       line pattern
  27. % ColorTable                      color array (set to Mono, Gray, or Color)
  28. % UserPat                         user-defined fill pattern
  29. % ptm                             pattern matrix
  30. %
  31. %
  32. % TEMPORARY, WORKING VALUES:
  33. % x1,y1,x2,y2                     rectangle coordinates
  34. % top,dep,ydep,h,w                3-D bar values
  35. % px1,py1,py2,pw,PatChar          pattern fill data
  36. % savematrix                      temporary storage
  37. %
  38. % -------------------------------------------------------------------------
  39.  
  40. /GrafDrivDict 100 dict def
  41. /ReEncodeDict 12 dict def
  42. GrafDrivDict begin
  43.  
  44. % ---------------------- PERMANENT DEFINITIONS ----------------------------
  45. /StdLine 2 def     % Normal line width, in decipoints
  46. /Thick   8 def     % Thick line width, as multiple of StdLine
  47.  
  48. /GrayColors
  49. [ 1.00 0.11 0.59 0.70 0.30 0.41 0.40 0.97 0.50 0.40 0.73 0.80 0.53 0.60 0.93
  50.   0.00  ] def
  51.  
  52. /MonoColors
  53. [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] def
  54.  
  55. /ColorColors
  56. [
  57.   [1 1 1]                         % white
  58.   [0 0 1]                         % blue
  59.   [0 1 0]                         % green
  60.   [0 1 1]                         % cyan
  61.   [1 0 0]                         % red
  62.   [1 0 1]                         % magenta
  63.   [0.67  0.33  0]                 % brown
  64.   [0.75 0.75 0.75]                % lightgray
  65.   [0.2 0.2 0.2]                   % darkgray
  66.   [0.33 0.33 1]                   % lightblue
  67.   [0.33  1 0.33]                  % lightgreen
  68.   [0.33 1 1]                      % lightcyan
  69.   [1 0.33  0.33]                  % lightred
  70.   [1 0.33  1]                     % lightmagenta
  71.   [1 1 0.33]                      % yellow
  72.   [0 0 0]                         % black
  73. ] def
  74.  
  75. /Color256
  76. [
  77.  [ 1    1    1    ]     % background color-- should be white=1,1,1
  78.  [ 0.07 0.07 0.07 ]
  79.  [ 0.14 0.14 0.14 ]
  80.  [ 0.21 0.21 0.21 ]
  81.  [ 0.28 0.28 0.28 ]
  82.  [ 0.35 0.35 0.35 ]
  83.  [ 0.42 0.42 0.42 ]
  84.  [ 0.50 0.50 0.50 ]
  85.  [ 0.57 0.57 0.57 ]
  86.  [ 0.64 0.64 0.64 ]
  87.  [ 0.71 0.71 0.71 ]
  88.  [ 0.78 0.78 0.78 ]
  89.  [ 0.85 0.85 0.85 ]
  90.  [ 0.93 0.93 0.93 ]
  91.  [ 1    1    1    ]
  92.  [ 0.12 0    0    ]
  93.  [ 0.25 0    0    ]
  94.  [ 0.37 0    0    ]
  95.  [ 0.50 0    0    ]
  96.  [ 0.62 0    0    ]
  97.  [ 0.75 0    0    ]
  98.  [ 0.87 0    0    ]
  99.  [ 1    0    0    ]
  100.  [ 1    0.12 0.12 ]
  101.  [ 1    0.25 0.25 ]
  102.  [ 1    0.37 0.37 ]
  103.  [ 1    0.50 0.50 ]
  104.  [ 1    0.62 0.62 ]
  105.  [ 1    0.75 0.75 ]
  106.  [ 1    0.87 0.87 ]
  107.  [ 0.12 0.04 0    ]
  108.  [ 0.25 0.08 0    ]
  109.  [ 0.37 0.12 0    ]
  110.  [ 0.50 0.16 0    ]
  111.  [ 0.62 0.20 0    ]
  112.  [ 0.75 0.24 0    ]
  113.  [ 0.87 0.29 0    ]
  114.  [ 1    0.33 0    ]
  115.  [ 1    0.41 0.12 ]
  116.  [ 1    0.49 0.25 ]
  117.  [ 1    0.58 0.37 ]
  118.  [ 1    0.66 0.50 ]
  119.  [ 1    0.75 0.62 ]
  120.  [ 1    0.83 0.75 ]
  121.  [ 1    0.91 0.87 ]
  122.  [ 0.12 0.08 0    ]
  123.  [ 0.25 0.16 0    ]
  124.  [ 0.37 0.25 0    ]
  125.  [ 0.50 0.33 0    ]
  126.  [ 0.62 0.42 0    ]
  127.  [ 0.75 0.50 0    ]
  128.  [ 0.87 0.58 0    ]
  129.  [ 1    0.67 0    ]
  130.  [ 1    0.71 0.12 ]
  131.  [ 1    0.75 0.25 ]
  132.  [ 1    0.79 0.37 ]
  133.  [ 1    0.83 0.50 ]
  134.  [ 1    0.87 0.62 ]
  135.  [ 1    0.91 0.75 ]
  136.  [ 1    0.95 0.87 ]
  137.  [ 0.12 0.12 0    ]
  138.  [ 0.25 0.25 0    ]
  139.  [ 0.37 0.37 0    ]
  140.  [ 0.50 0.50 0    ]
  141.  [ 0.62 0.62 0    ]
  142.  [ 0.75 0.75 0    ]
  143.  [ 0.87 0.87 0    ]
  144.  [ 1    1    0    ]
  145.  [ 1    1    0.12 ]
  146.  [ 1    1    0.25 ]
  147.  [ 1    1    0.37 ]
  148.  [ 1    1    0.50 ]
  149.  [ 1    1    0.62 ]
  150.  [ 1    1    0.75 ]
  151.  [ 1    1    0.87 ]
  152.  [ 0.08 0.12 0    ]
  153.  [ 0.16 0.25 0    ]
  154.  [ 0.25 0.37 0    ]
  155.  [ 0.33 0.50 0    ]
  156.  [ 0.42 0.62 0    ]
  157.  [ 0.50 0.75 0    ]
  158.  [ 0.58 0.87 0    ]
  159.  [ 0.67 1    0    ]
  160.  [ 0.71 1    0.12 ]
  161.  [ 0.75 1    0.25 ]
  162.  [ 0.79 1    0.37 ]
  163.  [ 0.83 1    0.50 ]
  164.  [ 0.87 1    0.62 ]
  165.  [ 0.91 1    0.75 ]
  166.  [ 0.95 1    0.87 ]
  167.  [ 0.04 0.12 0    ]
  168.  [ 0.08 0.25 0    ]
  169.  [ 0.12 0.37 0    ]
  170.  [ 0.16 0.50 0    ]
  171.  [ 0.20 0.62 0    ]
  172.  [ 0.24 0.75 0    ]
  173.  [ 0.29 0.87 0    ]
  174.  [ 0.33 1    0    ]
  175.  [ 0.41 1    0.12 ]
  176.  [ 0.49 1    0.25 ]
  177.  [ 0.58 1    0.37 ]
  178.  [ 0.66 1    0.50 ]
  179.  [ 0.75 1    0.62 ]
  180.  [ 0.83 1    0.75 ]
  181.  [ 0.91 1    0.87 ]
  182.  [ 0    0.12 0    ]
  183.  [ 0    0.25 0    ]
  184.  [ 0    0.37 0    ]
  185.  [ 0    0.50 0    ]
  186.  [ 0    0.62 0    ]
  187.  [ 0    0.75 0    ]
  188.  [ 0    0.87 0    ]
  189.  [ 0    1    0    ]
  190.  [ 0.12 1    0.12 ]
  191.  [ 0.25 1    0.25 ]
  192.  [ 0.37 1    0.37 ]
  193.  [ 0.50 1    0.50 ]
  194.  [ 0.62 1    0.62 ]
  195.  [ 0.75 1    0.75 ]
  196.  [ 0.87 1    0.87 ]
  197.  [ 0    0.12 0.04 ]
  198.  [ 0    0.25 0.08 ]
  199.  [ 0    0.37 0.12 ]
  200.  [ 0    0.50 0.16 ]
  201.  [ 0    0.62 0.20 ]
  202.  [ 0    0.75 0.24 ]
  203.  [ 0    0.87 0.29 ]
  204.  [ 0    1    0.33 ]
  205.  [ 0.12 1    0.41 ]
  206.  [ 0.25 1    0.49 ]
  207.  [ 0.37 1    0.58 ]
  208.  [ 0.50 1    0.66 ]
  209.  [ 0.62 1    0.75 ]
  210.  [ 0.75 1    0.83 ]
  211.  [ 0.87 1    0.91 ]
  212.  [ 0    0.12 0.08 ]
  213.  [ 0    0.25 0.16 ]
  214.  [ 0    0.37 0.25 ]
  215.  [ 0    0.50 0.33 ]
  216.  [ 0    0.62 0.42 ]
  217.  [ 0    0.75 0.50 ]
  218.  [ 0    0.87 0.58 ]
  219.  [ 0    1    0.67 ]
  220.  [ 0.12 1    0.71 ]
  221.  [ 0.25 1    0.75 ]
  222.  [ 0.37 1    0.79 ]
  223.  [ 0.50 1    0.83 ]
  224.  [ 0.62 1    0.87 ]
  225.  [ 0.75 1    0.91 ]
  226.  [ 0.87 1    0.95 ]
  227.  [ 0    0.12 0.12 ]
  228.  [ 0    0.25 0.25 ]
  229.  [ 0    0.37 0.37 ]
  230.  [ 0    0.50 0.50 ]
  231.  [ 0    0.62 0.62 ]
  232.  [ 0    0.75 0.75 ]
  233.  [ 0    0.87 0.87 ]
  234.  [ 0    1    1    ]
  235.  [ 0.12 1    1    ]
  236.  [ 0.25 1    1    ]
  237.  [ 0.37 1    1    ]
  238.  [ 0.50 1    1    ]
  239.  [ 0.62 1    1    ]
  240.  [ 0.75 1    1    ]
  241.  [ 0.87 1    1    ]
  242.  [ 0    0.08 0.12 ]
  243.  [ 0    0.16 0.25 ]
  244.  [ 0    0.25 0.37 ]
  245.  [ 0    0.33 0.50 ]
  246.  [ 0    0.42 0.62 ]
  247.  [ 0    0.50 0.75 ]
  248.  [ 0    0.58 0.87 ]
  249.  [ 0    0.67 1    ]
  250.  [ 0.12 0.71 1    ]
  251.  [ 0.25 0.75 1    ]
  252.  [ 0.37 0.79 1    ]
  253.  [ 0.50 0.83 1    ]
  254.  [ 0.62 0.87 1    ]
  255.  [ 0.75 0.91 1    ]
  256.  [ 0.87 0.95 1    ]
  257.  [ 0    0.04 0.12 ]
  258.  [ 0    0.08 0.25 ]
  259.  [ 0    0.12 0.37 ]
  260.  [ 0    0.16 0.50 ]
  261.  [ 0    0.20 0.62 ]
  262.  [ 0    0.24 0.75 ]
  263.  [ 0    0.29 0.87 ]
  264.  [ 0    0.33 1    ]
  265.  [ 0.12 0.41 1    ]
  266.  [ 0.25 0.49 1    ]
  267.  [ 0.37 0.58 1    ]
  268.  [ 0.50 0.66 1    ]
  269.  [ 0.62 0.75 1    ]
  270.  [ 0.75 0.83 1    ]
  271.  [ 0.87 0.91 1    ]
  272.  [ 0    0    0.12 ]
  273.  [ 0    0    0.25 ]
  274.  [ 0    0    0.37 ]
  275.  [ 0    0    0.50 ]
  276.  [ 0    0    0.62 ]
  277.  [ 0    0    0.75 ]
  278.  [ 0    0    0.87 ]
  279.  [ 0    0    1    ]
  280.  [ 0.12 0.12 1    ]
  281.  [ 0.25 0.25 1    ]
  282.  [ 0.37 0.37 1    ]
  283.  [ 0.50 0.50 1    ]
  284.  [ 0.62 0.62 1    ]
  285.  [ 0.75 0.75 1    ]
  286.  [ 0.87 0.87 1    ]
  287.  [ 0.06 0    0.12 ]
  288.  [ 0.12 0    0.25 ]
  289.  [ 0.18 0    0.37 ]
  290.  [ 0.25 0    0.50 ]
  291.  [ 0.31 0    0.62 ]
  292.  [ 0.37 0    0.75 ]
  293.  [ 0.44 0    0.87 ]
  294.  [ 0.50 0    1    ]
  295.  [ 0.56 0.12 1    ]
  296.  [ 0.62 0.25 1    ]
  297.  [ 0.68 0.37 1    ]
  298.  [ 0.75 0.50 1    ]
  299.  [ 0.81 0.62 1    ]
  300.  [ 0.87 0.75 1    ]
  301.  [ 0.93 0.87 1    ]
  302.  [ 0.12 0    0.12 ]
  303.  [ 0.25 0    0.25 ]
  304.  [ 0.37 0    0.37 ]
  305.  [ 0.50 0    0.50 ]
  306.  [ 0.62 0    0.62 ]
  307.  [ 0.75 0    0.75 ]
  308.  [ 0.87 0    0.87 ]
  309.  [ 1    0    1    ]
  310.  [ 1    0.12 1    ]
  311.  [ 1    0.25 1    ]
  312.  [ 1    0.37 1    ]
  313.  [ 1    0.50 1    ]
  314.  [ 1    0.62 1    ]
  315.  [ 1    0.75 1    ]
  316.  [ 1    0.87 1    ]
  317.  [ 0.12 0    0.06 ]
  318.  [ 0.25 0    0.12 ]
  319.  [ 0.37 0    0.18 ]
  320.  [ 0.50 0    0.25 ]
  321.  [ 0.62 0    0.31 ]
  322.  [ 0.75 0    0.37 ]
  323.  [ 0.87 0    0.44 ]
  324.  [ 1    0    0.50 ]
  325.  [ 1    0.12 0.56 ]
  326.  [ 1    0.25 0.62 ]
  327.  [ 1    0.37 0.68 ]
  328.  [ 1    0.50 0.75 ]
  329.  [ 1    0.62 0.81 ]
  330.  [ 1    0.75 0.87 ]
  331.  [ 1    0.87 0.93 ]
  332.  [ 0    0    0    ]     % default color--should be black=0,0,0
  333. ] def
  334.  
  335. /ColorOptions
  336. [ MonoColors GrayColors ColorColors Color256] def
  337.  
  338. /CharSet
  339. [
  340.     10#128   /Ccedilla
  341.     10#129   /udieresis
  342.     10#130   /eacute
  343.     10#131   /acircumflex
  344.     10#132   /adieresis
  345.     10#133   /agrave
  346.     10#134   /aring
  347.     10#135   /ccedilla
  348.     10#136   /ecircumflex
  349.     10#137   /edieresis
  350.     10#138   /egrave
  351.     10#139   /idieresis
  352.     10#140   /icircumflex
  353.     10#141   /igrave
  354.     10#142   /Adieresis
  355.     10#143   /Aring
  356.     10#144   /Eacute
  357.     10#145   /ae
  358.     10#146   /AE
  359.     10#147   /ocircumflex
  360.     10#148   /odieresis
  361.     10#149   /ograve
  362.     10#150   /ucircumflex
  363.     10#151   /ugrave
  364.     10#152   /ydieresis
  365.     10#153   /Odieresis
  366.     10#154   /Udieresis
  367.     10#155   /cent
  368.     10#156   /sterling
  369.     10#157   /yen
  370.     10#158   /P
  371.     10#159   /florin
  372.     10#160   /aacute
  373.     10#161   /iacute
  374.     10#162   /oacute
  375.     10#163   /uacute
  376.     10#164   /ntilde
  377.     10#165   /Ntilde
  378.     10#166   /ordfeminine
  379.     10#167   /ordmasculine
  380.     10#168   /questiondown
  381. ] def
  382.  
  383. % --------------------------------------------------------------------
  384. % OldName NewName AF      Encode font OldName to NewName
  385. % --------------------------------------------------------------------
  386. /AF
  387. {
  388. ReEncodeDict begin
  389.     /NewName exch def  /OldName exch def
  390.     FontDirectory NewName known not
  391.     {
  392.         FontDirectory OldName known not { /OldName /Courier def } if
  393.         /BaseFontDict OldName findfont def
  394.         /NewFontDict BaseFontDict maxlength dict def
  395.         BaseFontDict
  396.         {
  397.             exch dup /FID ne
  398.             {
  399.                 dup /Encoding eq
  400.                 {
  401.                     exch dup length array copy
  402.                     NewFontDict 3 1 roll put
  403.                 }
  404.                 {
  405.                     exch NewFontDict 3 1 roll put
  406.                 }
  407.                 ifelse
  408.             }
  409.             {
  410.                 pop pop
  411.             }
  412.             ifelse
  413.         } forall
  414.  
  415.         NewFontDict /FontName NewName put
  416.  
  417.         CharSet aload
  418.         length 2 idiv
  419.         {
  420.             NewFontDict /Encoding get 3 1 roll put
  421.         }
  422.         repeat
  423.  
  424.         NewName NewFontDict definefont pop
  425.     } if
  426. end
  427. } bind def
  428.  
  429.  
  430. % ---------------------------------------------------------------------------
  431. %                           PATTERN FILLS
  432. % ---------------------------------------------------------------------------
  433. /newfont 10 dict def
  434. newfont begin
  435.  
  436. /FontType 3 def
  437. /FontMatrix [ 1 0 0 1 0 0 ] def
  438. /FontBBox [ 0 0 8 8 ] def
  439. /Encoding 256 array def
  440.   0 1 255 { Encoding exch /.notdef put } for
  441.   Encoding  99 /linefill  put      % c=2
  442.   Encoding 100 /ltslash   put      % d=3
  443.   Encoding 101 /slash     put      % e=4
  444.   Encoding 102 /bkslash   put      % f=5
  445.   Encoding 103 /ltbkslash put      % g=6
  446.   Encoding 104 /hatch     put      % h=7
  447.   Encoding 105 /xhatch    put      % i=8
  448.   Encoding 106 /interleav put      % j=9
  449.   Encoding 107 /widedot   put      % k=10
  450.   Encoding 108 /closedot  put      % l=11
  451.   Encoding 122 /userfill  put      % z=12
  452.  
  453.  
  454. /CharProcs 16 dict def
  455. CharProcs begin
  456. /.notdef {} bind def
  457. /linefill  { 8 8 true [1 0 0 -1 0 8] { <ffff0000ffff0000> } imagemask } bind def
  458. /ltslash   { 8 8 true [1 0 0 -1 0 8] { <0102040810204080> } imagemask } bind def
  459. /slash     { 8 8 true [1 0 0 -1 0 8] { <e0c183070e1c3870> } imagemask } bind def
  460. /bkslash   { 8 8 true [1 0 0 -1 0 8] { <f0783c1e0f87c3e1> } imagemask } bind def
  461. /ltbkslash { 8 8 true [1 0 0 -1 0 8] { <a5d269b45a2d964b> } imagemask } bind def
  462. /hatch     { 8 8 true [1 0 0 -1 0 8] { <ff888888ff888888> } imagemask } bind def
  463. /xhatch    { 8 8 true [1 0 0 -1 0 8] { <8142241818244281> } imagemask } bind def
  464. /interleav { 8 8 true [1 0 0 -1 0 8] { <cc33cc33cc33cc33> } imagemask } bind def
  465. /widedot   { 8 8 true [1 0 0 -1 0 8] { <8000080080000800> } imagemask } bind def
  466. /closedot  { 8 8 true [1 0 0 -1 0 8] { <8800220088002200> } imagemask } bind def
  467. /userfill  { 8 8 true [1 0 0 -1 0 8] { UserPat            } imagemask } bind def
  468. end
  469.  
  470. /BuildChar       % fontdic charcode BuildChar
  471. {
  472.     exch begin
  473.         dup  122 eq
  474.         {
  475.             8 0 setcharwidth
  476.         }{
  477.             8 0   0 0 8 8  setcachedevice
  478.         } ifelse
  479.         Encoding exch get
  480.         CharProcs exch get
  481.     end
  482.     exec
  483. } bind def
  484. end % of newfont
  485. /PatFont newfont definefont pop
  486.  
  487. /UserPat <0001020400402010>  def
  488. /PatChar (a) def
  489.  
  490. /patfill
  491. {
  492.     gsave
  493.     eoclip
  494. %   gsave 1 setgray fill grestore
  495.     gsave 0 CS      fill grestore
  496.     ptm setmatrix /PatFont findfont 1 scalefont setfont
  497.     PatChar 0 FillStyle 97 add put
  498.  
  499.     pathbbox newpath
  500.     4 2 roll
  501.     cvi 3 not and /py1 exch def
  502.     cvi 3 not and /px1 exch def
  503.     /py2 exch def
  504.     px1 sub 8 div ceiling cvi /pw exch def
  505.  
  506.     py1 8 py2
  507.     {
  508.         px1 exch moveto
  509.         pw { PatChar show } repeat
  510.     } for
  511.  
  512.     grestore
  513. } bind def
  514.  
  515. % ---------------------------------------------------------------------------
  516.  
  517.  
  518.  
  519. /xround
  520. {
  521.     dup round dup 0 eq
  522.     {
  523.         2 -1 roll 0 lt { -1 } { 1 } ifelse
  524.     }if
  525.     2 -1 roll pop
  526. } bind def
  527.  
  528. /roundup
  529. {
  530.     dup 0 lt {floor} {ceiling} ifelse
  531. } bind def
  532.  
  533. /N { newpath } bind def
  534. /M { moveto } bind def
  535. /L { lineto } bind def
  536. /C { closepath } bind def
  537.  
  538.  
  539. % ----------------------------------------------------------------------
  540. % x1 y1 x2 y2       REC    draw rectangle (x1,y1)-(x2,y2)
  541. % ----------------------------------------------------------------------
  542. /REC
  543. {
  544.     transform round exch round exch itransform 4 2 roll
  545.     transform round exch round exch itransform 4 2 roll
  546.     /y2 exch def  /x2 exch def  /y1 exch def  /x1 exch def
  547.     newpath
  548.     x1 y1 moveto
  549.     x2 y1 lineto
  550.     x2 y2 lineto
  551.     x1 y2 lineto
  552.     closepath
  553. } bind def
  554.  
  555. % ----------------------------------------------------------------------
  556. %                   SK     stroke the current path
  557. % ----------------------------------------------------------------------
  558. /SK
  559. {
  560.     gsave DrawColor CS stroke grestore newpath
  561. } bind def
  562.  
  563. % ----------------------------------------------------------------------
  564. %                   FILL   fill the current path
  565. % ----------------------------------------------------------------------
  566. /FILL
  567. {
  568.     gsave
  569.     FillStyle 0 eq { 1 setgray }{ FillColor CS } ifelse
  570.     FillStyle 1 le ColorMode 1 eq or
  571.     { eoclip fill } { patfill } ifelse
  572.     grestore
  573. } bind def
  574.  
  575. % ----------------------------------------------------------------------
  576. % x1 y1 x2 y2       VEC    draw line from (x1,y1) to (x2,y2)
  577. % ----------------------------------------------------------------------
  578. /VEC
  579. {
  580.     transform round exch round exch itransform 4 2 roll
  581.     transform round exch round exch itransform 4 2 roll
  582.     newpath moveto lineto SK
  583. } bind def
  584.  
  585. % ----------------------------------------------------------------------
  586. % x1 y1             VS     start path
  587. % ----------------------------------------------------------------------
  588. /VS
  589. {
  590.     transform round exch round exch itransform
  591.     newpath moveto
  592. } bind def
  593.  
  594. % ----------------------------------------------------------------------
  595. % x  y              VR     close/continue path
  596. % ----------------------------------------------------------------------
  597. /VR
  598. {
  599.     transform round exch round exch itransform
  600.     closepath moveto
  601. } bind def
  602.  
  603. % ----------------------------------------------------------------------
  604. % x  y              VC     continue path
  605. % ----------------------------------------------------------------------
  606. /VC
  607. {
  608.     transform round exch round exch itransform
  609.     lineto
  610. } bind def
  611.  
  612. % ----------------------------------------------------------------------
  613. % x  y  c           PX     simulated putpixel
  614. % ----------------------------------------------------------------------
  615. /PX
  616. {
  617.     gsave
  618.     newpath CS 1 setlinewidth [] 0 setdash
  619.     transform round exch round exch itransform
  620.     moveto 0 0 rlineto stroke
  621. %   1 0 360 arc fill
  622.     grestore
  623. } bind def
  624.  
  625. % ----------------------------------------------------------------------
  626. % x1 y1 x2 y2 d t   BAR    fill and outline rectangle (x1,y1)-(x2,y2)
  627. % ----------------------------------------------------------------------
  628. /BAR
  629. {
  630.     /top exch def /dep exch def
  631.     REC FILL
  632.     newpath
  633.     x2 y1 moveto
  634.     x1 y1 lineto
  635.     x1 y2 lineto
  636.     x2 y2 lineto
  637.     x2 y1 lineto
  638.     dep 0 ne { BARDEP } if
  639.     SK
  640. } bind def
  641.  
  642. /BARDEP
  643. {
  644.     dep .6 mul /ydep exch def
  645.     y2 y1 sub /h exch def
  646.     x2 x1 sub /w exch def
  647.     dep ydep rlineto
  648.     0 h rlineto
  649.     top 0 ne { BARTOP } if
  650. } bind def
  651.  
  652. /BARTOP
  653. {
  654.     w neg 0 rlineto
  655.     dep neg ydep neg rlineto
  656.     w 0 rlineto
  657.     dep ydep rlineto
  658.     0 h neg rlineto
  659.     closepath
  660. } bind def
  661.  
  662. % ----------------------------------------------------------------------
  663. % x1 y1 x2 y2       PBR    fill rectangle (x1,y1)-(x2,y2)
  664. % ----------------------------------------------------------------------
  665. /PBR
  666. {
  667.     REC FILL
  668. } bind def
  669.  
  670. % ----------------------------------------------------------------------
  671. % xc yc th1 th2 a b EPATH  elliptical path
  672. % ----------------------------------------------------------------------
  673. /EPATH
  674. {
  675.     /savematrix matrix currentmatrix def
  676.     6 -2 roll translate scale
  677.     0 0 1 5 -2 roll arc
  678.     savematrix setmatrix
  679. } bind def
  680.  
  681. % ----------------------------------------------------------------------
  682. % xc yc th1 th2 a b ARC    draw an elliptical arc
  683. % ----------------------------------------------------------------------
  684. /ARC
  685. {
  686.     gsave
  687.     newpath EPATH [] 0 setdash SK
  688.     grestore
  689. } bind def
  690.  
  691. % ----------------------------------------------------------------------
  692. % xc yc th1 th2 a b PIE    draw and fill an elliptical pieslice
  693. % ----------------------------------------------------------------------
  694. /PIE
  695. {
  696.     gsave
  697.     newpath
  698.     6 -2 roll 2 copy moveto 6 2 roll
  699.     EPATH closepath FILL SK
  700.     grestore
  701. } bind def
  702.  
  703. % ----------------------------------------------------------------------
  704. % xc yc a b         ELI    draw and fill an ellipse
  705. % ----------------------------------------------------------------------
  706. /ELI
  707. {
  708.     4 2 roll 0 360 6 -2 roll
  709.     gsave
  710.     newpath EPATH FILL SK
  711.     grestore
  712. } bind def
  713.  
  714. % ----------------------------------------------------------------------
  715. % x y dx dy (text)  TXT    draw text at x,y
  716. % ----------------------------------------------------------------------
  717. /TXT
  718. {
  719.     gsave
  720.     DrawColor CS
  721.     5 -2 roll translate TxtDir 0 ne { 90 rotate } if
  722.     3 1 roll MoveChar mul 2 div
  723.     exch 2 index stringwidth pop mul 2 div
  724.     exch moveto show
  725.     grestore
  726. } bind def
  727.  
  728. % ----------------------------------------------------------------------
  729. % size dir font   TXS     sets text size
  730. % ----------------------------------------------------------------------
  731. /TXS
  732. {
  733.     /CurFont exch def /TxtDir exch def  /TxtHt exch def
  734.     CurFont findfont TxtHt scalefont setfont
  735.     /MoveChar TxtHt def
  736. %   newpath 0 0 moveto
  737. %   (0|h) false charpath flattenpath pathbbox newpath
  738. %   /MoveChar exch def 3 { pop } repeat
  739. } bind def
  740.  
  741. % ----------------------------------------------------------------------
  742. % array             LD      defines line style
  743. % ----------------------------------------------------------------------
  744. /LD
  745. {
  746.     dup /LineStyle exch def 0 setdash
  747. } bind def
  748.  
  749. % ----------------------------------------------------------------------
  750. % draw fill         CD      defines colors
  751. % ----------------------------------------------------------------------
  752. /CD
  753. {
  754.     /FillColor exch def  /DrawColor exch def
  755. } bind def
  756.  
  757. % ----------------------------------------------------------------------
  758. % pat#              FD      defines fill pattern
  759. % ----------------------------------------------------------------------
  760. /FD
  761. {
  762.     /FillStyle exch def
  763. } bind def
  764.  
  765. % ----------------------------------------------------------------------
  766. % patstr            FPD     defines user fill
  767. % ----------------------------------------------------------------------
  768. /FPD
  769. {
  770.     /UserPat exch def  /FillStyle 25 def
  771. } bind def
  772.  
  773. % ----------------------------------------------------------------------
  774. % color             CS      select  color
  775. % ----------------------------------------------------------------------
  776. /CS
  777. {
  778.     ColorTable exch get
  779.     dup type /arraytype ne { setgray }{ {} forall setrgbcolor } ifelse
  780. } bind def
  781.  
  782. % ----------------------------------------------------------------------
  783. % x1 y1 x2 y2       CLIP   set clipping region
  784. % ----------------------------------------------------------------------
  785. /CLIP
  786. {
  787.     transform round exch round exch itransform 4 2 roll
  788.     transform round exch round exch itransform 4 2 roll
  789.     grestore gsave   % reset to INXX state
  790.     0 setlinewidth REC eoclip newpath
  791.     % restore current graphics state
  792.     TxtHt TxtDir CurFont TXS
  793.     LineWidth setlinewidth
  794.     LineStyle 0 setdash
  795. } bind def
  796.  
  797.  
  798. % ----------------------------------------------------------------------
  799. % no                LW      set line width
  800. % ----------------------------------------------------------------------
  801. /LW
  802. {
  803.     StdLine mul dup /LineWidth exch def setlinewidth
  804. } bind def
  805.  
  806. % ----------------------------------------------------------------------
  807. % Width Height Orient Left Top Cmode      INXX    Initialize Page
  808. % Orient: 0=portrait, 1=landscape
  809. % ----------------------------------------------------------------------
  810. /INXX
  811. {
  812.     /PGstate save def
  813.     dup 3 gt { pop 0 } if /ColorMode exch def
  814.     ColorOptions ColorMode get /ColorTable exch def
  815.  
  816.     /ptm
  817.     [
  818.         1 1 matrix defaultmatrix dtransform xround exch xround exch
  819.         0 exch 0 exch 0 0
  820.     ] def
  821.     2 index 0 ne   % if landscape
  822.     {
  823.         /ptm
  824.         [
  825.             ptm aload pop 6 2 roll 4 2 roll neg exch neg exch 6 -2 roll
  826.         ] def
  827.     }
  828.     if
  829.  
  830.     0.1 0.1 scale translate
  831.  
  832.     0 eq
  833.     { neg 0 exch translate pop }                % portrait
  834.     { 90 rotate neg exch neg exch translate }   % landscape
  835.     ifelse
  836.  
  837.     /StdLine
  838.     StdLine dup dtransform roundup exch roundup exch idtransform pop
  839.     def
  840.  
  841.     /Courier /CourierGD AF
  842.     120 0 /CourierGD TXS
  843.     15 15 CD
  844.     1  FD
  845.     1  LW
  846.     [] LD
  847.     1.415 setmiterlimit
  848.     gsave
  849. } bind def
  850.  
  851. % ----------------------------------------------------------------------
  852. %                   TERM    Display Page
  853. % ----------------------------------------------------------------------
  854. /TERM
  855. {
  856. %xx PGstate restore
  857.     showpage
  858.     PGstate restore
  859. } bind def
  860.  
  861.  
  862. % ----------------------------------------------------------------------
  863. % ulx uly width height imagecols imagerows CI  hexdata      ;Color Image
  864. % ----------------------------------------------------------------------
  865. /CI
  866. {
  867.     gsave
  868.     /rows exch def /cols exch def
  869.     4 2 roll translate scale
  870.     /picstr cols string def
  871.  
  872.     cols rows 8
  873.     [ cols 0 0 rows neg 0 0 ]
  874.     { currentfile picstr readhexstring pop }
  875.     false 3 colorimage
  876.     grestore
  877. } bind def
  878.  
  879.  
  880. % ----------------------------------------------------------------------
  881. % ulx uly width height imagecols imagerows bits GI  hexdata ;GrayScale Image
  882. % ----------------------------------------------------------------------
  883. /GI
  884. {
  885.     gsave
  886.     /bits exch def /rows exch def /cols exch def
  887.     4 2 roll translate scale
  888. %   /picstr rows string def
  889.     /picstr cols 8 idiv bits mul string def
  890.  
  891.     cols rows bits
  892.     [ cols 0 0 rows neg 0 0 ]
  893.     { currentfile picstr readhexstring pop }
  894.     image
  895.     grestore
  896. } bind def
  897.  
  898.  
  899. % ................ INSERT ANY USER PROCS HERE ........................
  900. %  Always use gsave/grestore around user proc code
  901.  
  902. % This is an example of a User Proc to display text rotated to any
  903. % angle.  It does not work for stroked fonts, only for DEFAULT_FONT
  904. % and PostScript fonts
  905.  
  906. /ROT                      %    x y (text) angle ROT
  907. {
  908.     gsave
  909.     DrawColor CS          % select the drawing color
  910.     4 -2 roll translate   % move the origin to (x,y)
  911.     rotate                % rotate to angle
  912.                           % compute coords to center vertically
  913.     0 0 moveto (X) false charpath flattenpath pathbbox newpath
  914.     2 index add -2 div 0 exch moveto pop pop pop
  915.     show
  916.     grestore
  917. } bind def
  918.  
  919. % ....................................................................
  920.  
  921. %%EndProlog
  922.  
  923.